


#include <stdio.h>

#include <string.h>

void* Memcpy(void* dst, const void* src, size_t n)
{
	void* res = dst;

	for (int i = 0; i < n; ++i)
	{
		//((char*)dst)[i] = ((char*)src)[i]; // ok
		//*((char*)dst + i) = *((char*)src + i);// ok
		//(char*)dst[i] = (char*)src[i];// err
		*((char*)dst)++ = *((char*)src)++; // ok
	}

	return res;
}

int main()
{
	char dst[100] = "hello";
	char* src = " world!";

	Memcpy(dst + 5, src, strlen(src) + 1);

	printf(dst);


	return 0;
}